
package com.zodiac.app.datathinking.configuration;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.Map;

/**
 * 自定义-应用属性
 */
@Data
@ConfigurationProperties("customize")
public class CustomizeApplicationProperties {

    private Szse szse;

    @Data
    public static class Szse {
        private Map<String, ApiConfig> apis;

        @Data
        public static class ApiConfig {
            private String url;

            public String parseUrl(Map<String, Object> params) {
                String toParseUrl = String.valueOf(url);
                for (Map.Entry<String, Object> entry : params.entrySet()) {
                    toParseUrl = toParseUrl.replace("{" + entry.getKey() + "}", entry.getValue().toString());
                }
                return toParseUrl;
            }

        }
    }

}